// Created by WXX on 2021/12/22 17:18
#include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_map>

using namespace std;

class Solution {
public:
    int maxEqualRowsAfterFlips(vector<vector<int>>& g) {

        unordered_map<string, int> cnt;

        int res = 0;
        for (int i = 0; i < g.size(); i++) {
            string a, b;
            for (auto c : g[i]) {
                a += to_string(c);
                b += to_string(c ^ 1);
            }
            res = max(res, max(++cnt[a], ++cnt[b]));
        }

        return res;
    }
};

int main() {

    vector<vector<int>> g = {
            {0, 1},
            {1, 0}
    };
    cout << Solution().maxEqualRowsAfterFlips(g) << endl;  // 2

    return 0;
}
